1. Field of the Invention
The present invention relates to a position detecting apparatus with a sampling function and, more particularly, to an apparatus for detecting the position of an object by first sampling repetitive periodic waveforms by a linear encoder and then processing the sampled data.
2. Description of the Related Art
In a driving system for an optical unit in a video camera or the like where an object needs to be positioned with a high precision, it is generally customary of late to employ a direct drive motor which actuates the object directly without using any speed reduction mechanism. In this case, a position detecting apparatus for positioning the object requires a high resolution since no speed reduction mechanism is incorporated. Therefore it is usual to adopt a method which, for achieving such a high resolution, generates a periodic waveform in accordance with the motion of the object by a linear encoder or the like and, after sampling the periodic waveform, processes the sampled data through digital calculation to thereby detect the desired position.
FIG. 1 shows a hardware structure of an exemplary position detecting apparatus employing a conventional linear encoder. A sensor incorporated in this position detecting apparatus has an optical linear encoder 2 and, when an object 1 to be measured is moved in a direction indicated by an arrow, the sensor generates, per fixed distance or period .lambda., sine and cosine waves having an amplitude A on both sides of a center V0.
FIG. 2 is an explanatory diagram schematically showing an exemplary constitution of such an optical linear encoder 2. Slits are arrayed at an interval equivalent to the period .lambda. in a movable slit member 2-2 which is displaced with the object 1. A laser beam emitted from a semiconductor laser 2-1 such as an LED; and through the movable slit member 2-2 and is received by two optical detectors 2-4 disposed opposite to two fixed slits 2-3 formed at an interval of .lambda./4, whereby the sine and cosine waves of the period .lambda. are detected by the two optical detectors 2-4.
The waves Asin.theta. and Acos.theta. outputted from the sensor are supplied respectively via sample hold circuits 3, 3 and an analog selector 4 to an A/D converter 5 where analog-to-digital conversion 5 is executed to produce digital data, which are then supplied to a CPU 6. The sampling timing and so forth are controlled by the CPU 6 on the basis of a signal obtained from an external timer circuit 7.
FIG. 3 graphically shows the output of the sensor, in which sine and cosine waves of the period corresponding to the distance .lambda., are outputted in accordance with the motion of the object to be measured.
FIG. 4 is a flowchart for explaining an algorithm to detect the position of the object by utilizing the outputs of the sensor.
In this algorithm, first the detection outputs Asin.theta., Acos.theta. and V0 are sampled by the sample hold circuits 3, 3 (step 1) and, after selection by the analog selector 4 and subsequent analog-to-digital conversion by the A/D converter 5, the digital data are inputted to the CPU 6 (step 2).
According to the following equations, *Asin.theta. and *Acos.theta. are calculated from the digital data Asin.theta., Acos.theta. and V0 thus inputted (step 3). EQU *Asin.theta.=V0-(Asin.theta.-V0)=2V0-Asin.theta. (1) EQU *Acos.theta.=V0-(Acos.theta.-V0)=2V0-Acos.theta. (2)
The data *Asin.theta. and *Acos.theta. represent the waveforms where Asin.theta. and Acos.theta. are inverted respectively with respect to V0 at the center. FIG. 5 graphically shows the relationship between such two waveforms.
Subsequently the waveform values of Asin.theta., Acos.theta., *Asin.theta. and *Acos.theta. are compared with one another, and a calculation is executed to find the current position in the 8-phase data composed of the four waveforms shown in FIG. 6. The relationship among the values of the four waveforms in the individual phases is listed in a table of FIG. 7, and the current phase S(n) is calculated by using the table. Thereafter the distance .+-..DELTA.L (where .+-. denotes the directions) of the motion during the sampling action, i.e., the direction and the length in the current motion, are calculated from the values of the current phase S(n) and the preceding phase S(n-1) by using the relationship of variations shown in a table of FIG. 8 (step 4). It signifies that when .lambda.=400 .mu.m for example, 1 phase is equivalent to 50 .mu.m, and if the length of the motion corresponds to -2 phases, the object has moved by a length of 100 .mu.m in the direction (-) during the sampling action.
The current position POS(n) can be calculated by adding to the preceding position POS(n-1) the motion length .+-..DELTA.L thus obtained during the sampling action (step 5). EQU POS(n)=POS(n-1).+-..DELTA.L (3)
And finally, according to the following equation, both the position POS and the phase S are delayed for the time corresponding to one sampling action (step 6). EQU POS(n-1)=POS(n), S(n-1)=S(n)
The above is an algorithm for detection of the position, and the position of the object 1 can be detected by repeating the procedure in the flowchart.
According to the above-described conventional algorithm for detection of the position, when the object to be measured has moved by the distance of .lambda./2 during one sampling action, the direction of the motion is unknown as shown in the table of FIG. 8, and the variation or the distance of the motion during the sampling action is indefinite. Furthermore, in case the object has moved by any length greater than .lambda./2 during one sampling action, it follows that both the distance and the direction of the motion are prone to be mistaken.
In averting such errors, there exist some restrictions in the prior art relative to the performance including that the maximum motion distance of the object to be measured, i.e., the maximum velocity thereof during one sampling action, needs to be limited to a value smaller than .lambda./2 during one sampling action. Meanwhile, for alleviating such restriction, it becomes necessary to enhance the capability of the CPU for shortening the sampling period and also to provide an external hardware counter. Thus, due to such additional requirements, there arises another problem that the production cost is increased.